<template>
	<view>
		<es-list class="list-wrap" ref="esList" :apiMethod="getList" scrollView isPager :apiParams="{ a: 1 }" >
			<template slot-scope="scope">
				<view class="list-item">
					{{scope.item}}
				</view>
			</template>
		</es-list>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				getList: (params) => {
					
					// 假设是请求后端接口返回的数据
					const esConfig = uni.esConfig
					
					const curPage = params[esConfig.page]
					console.log(params)
					return new Promise((res, rej) => {
						setTimeout(() => {
							let data = new Array(20).fill('').map((item, index) => {
								return `第${(index + 1) + (Number(curPage) - 1) * 20}条数据`
							})
							res(curPage < 5 ? data : [])
						}, 2000)
					})
				}
			}
		},
		methods: {
			
		}
	}
</script>

<style lang="scss">
	
	.list-item {
		background-color: #fff;
		line-height: 100rpx;
		padding: 0 30rpx;
		border-bottom: 1rpx solid #eee;
	}
</style>
